
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><?php echo $title;?></title>
    <!-- 设置缩放 -->
    <meta name="viewport" content="minimal-ui,width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
    <meta name="format-detection" content="telephone=no" />
    <!-- windows phone 点击无高光 -->
    <meta name="msapplication-tap-highlight" content="no" />
    <!-- icon -->
    <link rel="shortcut icon" href="<?php echo ADMIN_ICO_PIC;?>" type="image/x-icon"/>
    <!-- css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SYS_LINK;?>admin/css/content.css?v=<?php echo V_CSSJS;?>" />
    <style>

    </style>
</head>
<?php
$userLevel = getUserLevel();
$navType = isset($navType) ? $navType : 0;
$userLevelNone = $userLevel != 1 ? 'userLevelNone' : '';
?>
<body>
<div class="con_box">
    <div class="titleH18">添加左侧菜单</div>
    <form class="form_box">
        <input type="hidden" name="navtype" value="<?php echo $navType;?>">
        <input type="hidden" name="c" value="<?php echo $fid;?>">
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>所属模型</label>
            <select name="mould_code">
                <option value="">请选择</option>
                <?php
                if(isset($sysmould)) {
                    $fidMould = isset($fClass['mould_code']) ? $fClass['mould_code'] : '';
                    foreach ($sysmould as $v) {
                        $selected = $v['mouldcode'] == $fidMould ? 'selected="selecred"' : '';
                        echo '<option value="' . $v["mouldcode"] . '" '.$selected.'>' . $v["mouldname"] . '</option>';
                    }
                }
                ?>
            </select>
            <i class="hint">* (必选)</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>父级菜单</label>
            <select name="fid">
                <option value="">请选择</option>
                <?php
                if(!empty($classlist)){
                    foreach($classlist as $v){
                        $level = $v['level']*2;
                        $str = str_pad("",$level, '-',STR_PAD_LEFT );
                        $fontb = $v['fid'] == 0 ? 'fontb' : '';
                        $select = $v['id'] == $fid ? 'selected="selected"' : '';
                        $class = $v['id'] == $fid ? 'act' : '';
                        echo '<option value="'.$v["id"].'" class="'.$fontb.' '.$class.'" '.$select.'>'.$str.'&nbsp;'.$v["menuname"].'</option>';
                    }
                }
                ?>
            </select>
            <i class="hint">* (可不选)</i>
        </div>
        <div class="form_item">
            <label>菜单名称</label>
            <input type="text" name="menuname" autocomplete="off" placeholder="请输入">
            <i class="hint">* (必填)</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>前端模版</label>
            <input type="text" name="tmpl" autocomplete="off" placeholder="前端网站url">
            <i class="hint">* (可为空)必须字母开头且不能存在汉字</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>详情模版</label>
            <input type="text" name="tmplinfo" autocomplete="off" placeholder="前端文章url默认模型编号">
            <i class="hint">* (可为空)必须字母开头且不能存在汉字</i>
        </div>
        <div class="form_item">
            <label>菜单外链</label>
            <input type="text" name="gourl" autocomplete="off" placeholder="http://或者https://开头">
            <i class="hint">* (可为空)</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>前端内链</label>
            <input type="text" name="weburl" autocomplete="off" placeholder="除域名后的url部分,可链接到其他页面">
            <i class="hint">* (可为空)</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>后台内链</label>
            <input type="text" name="adminurl" autocomplete="off" placeholder="除域名后的url部分,可链接到其他栏目">
            <i class="hint">* (可为空)</i>
        </div>
        <div class="form_item">
            <label>分页条数</label>
            <input type="number" name="pagelist" value="10" autocomplete="off" placeholder="前端每页条数" class="input100">
            <i class="hint">* (必填)必须正整数，前端每页条数，默认10</i>
        </div>
        <div class="form_item">
            <label>菜单排序</label>
            <input type="number" name="viewseq" value="0" autocomplete="off" placeholder="显示排序顺序" class="input100">
            <i class="hint">* (必填)必须正整数，显示排序顺序，越大越靠前，默认0</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>子父关联</label>
            <input type="number" name="findflag" value="0" autocomplete="off" placeholder="请填写数字" class="input100">
            <i class="hint">* (必填)子级层级数-文章内容是否可以子父关联，默认0</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>子集子父</label>
            <input type="number" name="sideflag" value="0" autocomplete="off" placeholder="请填写数字" class="input100">
            <i class="hint">* (必填)子级层级数-文章子集是否可以子父关联，默认0</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>前端菜单</label>
            <label class="radio"><input type="radio" value="1" name="homeflag">开启</label>
            <label class="radio"><input type="radio" value="2" name="homeflag" checked="checked">关闭</label>
            <i class="hint">* (必选)前端菜单位展示</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>内容类型</label>
            <label class="radio"><input type="radio" value="1" name="showtype">单页</label>
            <label class="radio"><input type="radio" value="2" name="showtype" checked="checked">列表</label>
            <i class="hint">* (必选)菜单内容类型</i>
        </div>

        <div class="form_item <?php echo $userLevelNone;?>">
            <label>自建列表</label>
            <label class="radio"><input type="radio" value="1" name="eleflag" >开启</label>
            <label class="radio"><input type="radio" value="2" name="eleflag" checked="checked">关闭</label>
            <i class="hint">* (必选)文章内容自定义字段列表</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>模版类型</label>
            <label class="radio"><input type="radio" value="1" name="tmpltype" checked="checked">1对1</label>
            <label class="radio"><input type="radio" value="2" name="tmpltype">1对N</label>
            <label class="radio"><input type="radio" value="3" name="tmpltype">1对M</label>
            <i class="hint">* (必选)前端网站url类型</i>
        </div>
        <div class="form_item">
            <label>菜单状态</label>
            <label class="radio"><input type="radio" value="1" name="status" checked="checked">开启</label>
            <label class="radio"><input type="radio" value="2" name="status">关闭</label>
            <label class="radio"><input type="radio" value="3" name="status">隐藏</label>
            <i class="hint">* (必选)菜单展示状态</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>开辟空间</label>
            <label class="radio"><input type="radio" value="1" name="spaceflag" checked="checked">开启</label>
            <label class="radio"><input type="radio" value="2" name="spaceflag" >关闭</label>
            <label class="radio"><input type="radio" value="3" name="spaceflag" >外链</label>
            <i class="hint">* (必选)是否允许添加文章，外链直达编辑</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>管理模式</label>
            <label class="radio"><input type="radio" value="1" name="setflag" checked="checked">通用</label>
            <label class="radio"><input type="radio" value="2" name="setflag" >新开</label>
            <i class="hint">* 后台内容管理模式(新开为二次开发自定义管理模版)</i>
        </div>
        <div class="form_item <?php echo $userLevelNone;?>">
            <label>管理模版</label>
            <input type="text" name="setpath" autocomplete="off" id="setpath" placeholder="管理模式为“新开”时必填">
            <i class="hint">* 必须字母开头且不能存在汉字如:admin_member</i>
        </div>
        <div class="form_item">
            <label>SEO标题</label>
            <input type="text" name="seotitle" autocomplete="off" placeholder="一般不超过80个字符">
            <i class="hint">* 网站title标签</i>
        </div>
        <div class="form_item">
            <label>SEO词汇</label>
            <input type="text" name="seokey" autocomplete="off" placeholder="一般不超过100个字符">
            <i class="hint">* 网站meta标签keywords属性(多个英文‘,’或‘|’分割)</i>
        </div>
        <div class="form_item">
            <label>SEO内容<br><br><br><br><br><br></label>
            <textarea name="seodesc" placeholder="一般不超过200个字符"></textarea>
            <i class="hint">* 网站meta标签description属性<br><br><br><br><br></i>
        </div>

        <div class="form_item">
            <label style="color:#ff7f77"> 编辑需保存 </label>
            <input type="button" id="sub_btn" value="提交保存" class="btn_base btn_back_sides btn_w300 btn_height35 btn_radius5">
        </div>
    </form>
</div>
</body>
<script language="javascript">
    var cssjsv = '<?php echo V_CSSJS;?>';
    var http_url = '<?php echo SYS_HOST;?>';
    var http_link = '<?php echo SYS_LINK;?>';
    var http_fix = '<?php echo SYS_URL_FIX;?>';
</script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/jquery.min.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/skin.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/common.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript">file_load('info');</script>
<script language="javascript">

    // 页面加载后
    window.onload = function () {

    }

    var flagSub = true;
    var addUrl = '<?php echo SYS_URL_PATH("admin_menu_add");?>';
    function submit(){
        var fromBox = $('.form_box');
        var param = getFormData(fromBox);
        param.append('subFlag', 'Y'); // 追加参数
        $.ajax({
            url:addUrl,
            dataType:'json',
            type:'POST',
            async: false,
            data: param,
            processData : false, // 使数据不做处理
            contentType : false, // 不要设置Content-Type请求头
            success: function(data){
                flagSub = true;
                if(data=='Y'){
                    layer.msg('添加成功');
                    setTimeout(function(){
                        parent.location.reload();
                    },2500);
                }else{
                    layer.msg('操作失败_'+data);
                }
            },
            error:function(response){
                flagSub = true;
                layer.msg('网络异常');
                console.log('网络异常：'+response);
            }
        });
    }

    $(function(){

        // 点击事件
        $('#sub_btn').on('click',function(){
            if(!flagSub){
                layer.msg('处理中……(禁止重复提交)');return false;
            }
            if(get_radio_val('setflag') == 2 && !($('#setpath').val())){
                layer.msg('管理模式为新开时管理模版必填');return false;
            }else{
                flagSub = false;
                submit();
            }
        })

    })
</script>
</html>